<?php
$opc = $_REQUEST["opc"];

SoloFun_SubirArchivo();

function SoloFun_SubirArchivo() {
    //dim objUpload		//'instance of Uplaod control
    /*set objUpload = server.CreateObject("Dundas.Upload.2")
	if err<>0 then
	   response.write err.description
	   response.end
	end if*/

    $MaxFileSize = 1048576 * 6;
    $MaxUploadSize = 1048576 * 6;
    //objUpload.SaveToMemory

    switch($opc) {
        case "2" :
            $Ruta = "SoloTemplates";
            break;
        case "3" :
            $Ruta = "anim";
            break;
        case "4" :
            $Ruta = "SoloStyles";
            break;
        case "6" :
            $Ruta = "xml";
            break;
        default:
            $Ruta = "images";
            break;
    }

    $strPath = $destination_path = getcwd().DIRECTORY_SEPARATOR;

    //$strPath = str_replace("/","\\",$strPath);
    //$strPath .= "\\" . $Ruta . "\\";
    //'response.write strPath
    //'response.end
    //foreach objUploadedFile in objUpload.Files
    //strFile=objUpload.GetFileName(objUploadedFile.OriginalPath)
    //strFileName= strPath & strFile
    $strFileName = $_FILES['File1']['name'];
    //objUploadedFile.SaveAs strFileName
    $target_path = $strPath . $Ruta.$strFileName;
    echo $target_path;
    @move_uploaded_file($_FILES['File1']['tmp_name'], $target_path);
    //Next
    /*if err<>0 then
	   response.write err.description
	   response.end
	end if
	set objUpload = nothing*/
}
?>
<html>
    <head>
        <title>Upload Archivo</title>
    </head>
    <body>
        <table border="0">
            <tr><td> El Archivo <b><?php echo $strFileName;?> </b> subido OK.</td>
            <tr>
                <td align="center"><br><input type='button' value='Cerrar' OnClick='CloseUpload();'></td>
        </table>
        <input type="hidden" value="<?php echo $strFileName;?>" name="strFileName" id="StrFileName">
        <!--<input type="hidden" name="campo" value="<?php /*echo $SOLO_CAMPO;*/?>">-->
    </body>
</html>
<script type="text/javascript">
    function CloseUpload()
    {
        window.opener.location.reload();
        window.close();
    }
</script>